Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(listener): poll a port multiple times until either "max_poll" or returned "None" #78

Merged
merged 3 commits into from
Oct 13, 2024

Conversation

hasezoey
Copy link
Contributor

@hasezoey hasezoey commented May 4, 2024

Fixes #71

Description

This PR adds a way to poll a Port more than once per Port::should_poll, as the implementation of Poll::poll should be non-blocking and return Ok(None) in the case there is nothing. (though there also exists #77)

Because i didnt want to break any existing Ports and because of #77 (and MockPoll), i set the default max_poll to 1 (to basically match the behavior of what it was before this PR).

This change is necessary, as already explained in #71, if EnableMouseCapture is set (in crossterm, which is the default in 1.9.2), then there are a LOT of events generated very quickly, but before this PR you would only get one event, then wait, then one event, then wait instead of "all" at once. (which can make the TUI very unresponsive)

Type of change

Please select relevant options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • My code follows the contribution guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I formatted the code with cargo fmt
  • I checked my code using cargo clippy and reports no warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have introduced no new C-bindings
  • The changes I've made are Windows, MacOS, UNIX, Linux compatible (or I've handled them using cfg target_os)
  • I increased or maintained the code coverage for the project, compared to the previous commit

Alternative

Alternatively to this PR we could also change the result of Poll::poll to return a vec, though i personally would not like to move this aggregation to the Poll implementation if possible.

@hasezoey
Copy link
Contributor Author

hasezoey commented May 5, 2024

Update: i now also added function port_1 (for the lack of a better name) to EventListenerCfg to add a manually constructed port (which was seemingly not possible before)

@kylegentle
Copy link

@veeso, do you think this PR addresses the polling issue (#71) well enough? I'm interested to see this fixed too -- happy to contribute in some way if it would be helpful.

@veeso veeso changed the base branch from main to 2.0 October 13, 2024 16:49
@veeso veeso merged commit 3c8e556 into veeso:2.0 Oct 13, 2024
4 checks passed
@hasezoey hasezoey deleted the portPollMultipleTimes branch October 13, 2024 17:13
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Oct 15, 2024
Released on 14/10/2024
 - Multi Host support:
    - Now it is possible to work on two different remotes remote A -> remote B instead of just localhost -> remote
    - Cli arguments now accept an additional remote-args for the left panel.
    - For more details read this issue #285.
    - Change between auth forms with <BACKTAB>
    - Bookmarks are automatically loaded into the last auth form.
 - Issue 289: Use uzers instead of the dead package users which has several vulnerabilities
 - Issue 290: Password prompt was broken
 - Issue 298: tuirealm 2.x
    - Fixed some performance issues where sometimes the app froze for a couple of seconds, thanks to this veeso/tui-realm#78.
 - Issue 292: New version alert was not displayed due to a semver regex issue.
 - Issue 291: Show .. directory before all the others in the explorer. If you click on it you'll go the parent directory (same as pressing <U>). No, you can't select it for transfers and it's actually been implemented in the worse way possible, because this little change would require a huge refactoring of the explorer component. I promise I will do it one day, but I dunno when.
 - Logging: filter out messages not related to termscp or remotefs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Ports are seemingly only polled once per event loop
3 participants